home *** CD-ROM | disk | FTP | other *** search
/ ADA Programming Guide / ADA Programming Guide.iso / ada_gnu / adainc / a-teiopi.ads < prev    next >
Text File  |  1996-01-30  |  4KB  |  93 lines

  1. ------------------------------------------------------------------------------
  2. --                                                                          --
  3. --                         GNAT RUNTIME COMPONENTS                          --
  4. --                                                                          --
  5. --                 A D A . T E X T _ I O . P I C T U R E S                  --
  6. --                                                                          --
  7. --                                 S p e c                                  --
  8. --                                                                          --
  9. --                            $Revision: 1.5 $                              --
  10. --                                                                          --
  11. --           Copyright (c) 1992,1993,1994 NYU, All Rights Reserved          --
  12. --                                                                          --
  13. -- GNAT is free software;  you can  redistribute it  and/or modify it under --
  14. -- terms of the  GNU General Public License as published  by the Free Soft- --
  15. -- ware  Foundation;  either version 2,  or (at your option) any later ver- --
  16. -- sion.  GNAT is distributed in the hope that it will be useful, but WITH- --
  17. -- OUT ANY WARRANTY;  without even the  implied warranty of MERCHANTABILITY --
  18. -- or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License --
  19. -- for  more details.  You should have  received  a copy of the GNU General --
  20. -- Public License  distributed with GNAT;  see file COPYING.  If not, write --
  21. -- to the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. --
  22. --                                                                          --
  23. ------------------------------------------------------------------------------
  24.  
  25. package Ada.Text_IO.Pictures is
  26.  
  27.    type Picture is private;
  28.  
  29.    function Valid (Item : in String) return Boolean;
  30.  
  31.    function To_Picture (Item : in String) return Picture;
  32.  
  33.    function To_String (Item : in Picture) return String;
  34.  
  35.    Max_Picture_Length : constant := 30;
  36.  
  37.    Picture_Error : exception;
  38.  
  39.    --  Localization features:
  40.  
  41.    Max_Currency_Length : constant := 10;
  42.  
  43.    subtype Currency_Length_Range is
  44.      Integer range 1 .. Max_Currency_Length;
  45.  
  46.    type Locale (Length : Currency_Length_Range := 1) is record
  47.       Currency    : String (1 .. Length) := "$";
  48.       Fill        : Character            := '*';
  49.       Separator   : Character            := ',';
  50.       Radix_Mark  : Character            := '.';
  51.    end record;
  52.  
  53.    generic
  54.       type Num is delta <> digits <>;
  55.  
  56.    package Edited_Output is
  57.  
  58.       Default_Locale  : Locale;
  59.  
  60.       function Length (Pic     : in Picture;
  61.                        Symbols : in Locale := Default_Locale)
  62.         return Natural;
  63.  
  64.       function Image (Item    : in Num;
  65.                       Pic     : in Picture;
  66.                       Symbols : in Locale  := Default_Locale)
  67.         return String;
  68.  
  69.       procedure Put (File    : in File_Type;
  70.                      Item    : in Num;
  71.                      Pic     : in Picture;
  72.                      Symbols : in Locale  := Default_Locale);
  73.  
  74.       procedure Put (Item    : in Num;
  75.                      Pic     : in Picture;
  76.                      Symbols : in Locale  := Default_Locale);
  77.  
  78.       procedure Put (To      : out String;
  79.                      Item    : in Num;
  80.                      Pic     : in Picture;
  81.                      Symbols : in Locale  := Default_Locale);
  82.  
  83.    end Edited_Output;
  84.  
  85. private
  86.  
  87.    type Picture is record
  88.       Length : Natural;
  89.       Data   : String (1 .. 30);
  90.    end record;
  91.  
  92. end Ada.Text_IO.Pictures;
  93.